package com.bush.mall.coupon.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.coupon.entity.SeckillSkuNoticeEntity;
import com.bush.mall.coupon.service.SeckillSkuNoticeService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 秒杀商品通知订阅
 * @author RUN
 * @date 2022-11-29
 */
@RestController
@RequestMapping("seckillskunotice")
@Api(tags = "秒杀商品通知订阅管理" )
public class SeckillSkuNoticeController {

    @Resource(name= SeckillSkuNoticeService.BEAN_ID)
    private SeckillSkuNoticeService seckillSkuNoticeService;

    /**
     * 分页查询秒杀商品通知订阅列表
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "分页查询秒杀商品通知订阅列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return seckillSkuNoticeService.queryForPage(current,size);
    }

    /**
     * 保存秒杀商品通知订阅表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "保存秒杀商品通知订阅表单")
    @PostMapping
    public Result saveSeckillSkuNotice(@RequestBody SeckillSkuNoticeEntity seckillSkuNotice){
        return seckillSkuNoticeService.saveSeckillSkuNotice(seckillSkuNotice);
    }

    /**
     * 修改秒杀商品通知订阅表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "修改秒杀商品通知订阅表单")
    @PutMapping
    public Result updateSeckillSkuNotice(@RequestBody SeckillSkuNoticeEntity seckillSkuNotice){
        return seckillSkuNoticeService.updateSeckillSkuNotice(seckillSkuNotice);
    }

    /**
     * 通过指定id删除秒杀商品通知订阅
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "通过指定id删除秒杀商品通知订阅")
    @DeleteMapping
    public Result deleteSeckillSkuNotice(Long id){
        return seckillSkuNoticeService.deleteSeckillSkuNotice(id);
    }

}
